<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="Author" content=" ">
    <title>Document</title>
    <style type="text/css">
        *{margin: 0;padding: 0;}
        a{text-decoration: none;}
        ul,li{list-style: none;}
        body{font-size: 14px;font-family: "微软雅黑";}
        #box{width: 300px;height: 100px;line-height: 100px;text-align: center;border: 1px green dashed;margin: 20px auto}
        #box #oSp{color: red;font-size: 16px;font-weight: 600}
    </style>
</head>
<body>
    <div id="box">
        <p>页面在<span id="oSp"></span>s 后跳转</p>
    </div>
    <script type="text/javascript">
    var osp = document.getElementById('oSp');
    var num = 5;
    var timer =  setInterval(function(){
        num--;
        osp.innerHTML = num;
        if(num==0){
            window.location.href = 'https://www.baidu.com/';
        }

    },1000)

    </script>
</body>
</html>
